"use strict";
import md5 from "js-md5";
export default {
	calcuMD5(pwd) {
    pwd = md5(md5(pwd) + "bby");
    return pwd;
  }
};
// Base64编码解码-解决：js-base64库的decode一直解析失败
// 编码
export function encode(str) {
  return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
  function toSolidBytes(match, p1) {
      return String.fromCharCode('0x' + p1);
  }));
}
// 解码
export function decode(str) {
  return decodeURIComponent(atob(str).split('').map(function (c) {
    return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
  }).join(''));
}